﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using EasyStudy.ProjectUpdate.DB;

namespace EasyStudy.UI.ProjectUpdate
{
    public partial class FrmAddProject : Form
    {
        public FrmAddProject()
        {
            InitializeComponent();
        }

        public string ProjectName
        {
            get { return txtProject.Text; }
            set { txtProject.Text = value; }
        }

        public string Comment
        {
            get { return txtComment.Text; }
            set { txtComment.Text = value; }
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ProjectName))
            {
                MessageBox.Show("请输入正确的项目名称！");
                return;
            }
            ProjectDBMgr.CreateAProject(ProjectName, Comment);
            MessageBox.Show("项目创建成功！");
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }
    }
}
